package cn.yitun.chat.yitunserverimbase.dao.contact;

import cn.yitun.chat.yitunservercommonlib.crud.yitun.CrudDao;
import cn.yitun.chat.yitunservercommonlib.dataentity.dto.contact.ContactRelationDto;
import cn.yitun.chat.yitunservercommonlib.dataentity.po.contact.ContactRelationInfo;
import cn.yitun.chat.yitunservercommonlib.dataentity.vo.contact.ContactRelationVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 联系人的相关信息
 * @author chenyitun
 * @email chenyitun@163.com
 * @date 2020-06-21 21:52:52
 */
@Mapper
public interface ContactRelationDao extends CrudDao<ContactRelationDto, ContactRelationInfo, ContactRelationVo> {

	int absDel(Long id);

	int batchAbsDel(Long[] ids);

	/**
	 * 通过聊天双方用户id获取
	 */
    ContactRelationVo getVOByContactUserId(@Param("ownerUserId") Long ownerUserId,
										   @Param("contactUserId") Long contactUserId);

	/**
	 * 更新对聊分类
	 */
    int updateChangeCategoryId(@Param("userId") Long userId,
							   @Param("id") Long id,
							   @Param("newCategoryId") Long newCategoryId);

	/**
	 * 移动分组
	 */
    int updateCategoryId(@Param("ownerUserId") Long ownerUserId,
						 @Param("contactUserIds") List<Long> contactUserIds,
						 @Param("categoryId") Long categoryId);

	/**
	 * 更新备注
	 */
	int updateRemark(@Param("ownerUserId") Long ownerUserId,
					 @Param("contactUserId") Long contactUserId,
					 @Param("remark") String remark);

	/**
	 * 删除
	 */
	int deleteByContactUserId(@Param("ownerUserId") Long ownerUserId,
							  @Param("contactUserId") Long contactUserId);

	/**
	 * 更新是否
	 */
	int updateIsBlocked(@Param("ownerUserId") Long ownerUserId,
						@Param("contactUserId") Long contactUserId,
						@Param("isBlocked") String isBlocked);

}
